package demo.practice.leetcode_offer;

public class Offer10_1_2 {


    public int fib(int n) {
        if (n <= 1)
            return n;

        int f1 = 0;
        int f2 = 1;
        for (int i = 2; i <= n; i++) {
            int tmp = (f1 + f2) % 1000000007;
            f1 = f2;
            f2 = tmp;
        }
        return f2;
    }

}
